﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Admin2022Soft2.Infrastructrue.Migrations
{
    public partial class _9999 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_AppUserRole_AppRole_AppRoleId",
                table: "AppUserRole");

            migrationBuilder.DropForeignKey(
                name: "FK_AppUserRole_AppUser_AppUserId",
                table: "AppUserRole");

            migrationBuilder.DropPrimaryKey(
                name: "PK_AppUserRole",
                table: "AppUserRole");

            migrationBuilder.DropPrimaryKey(
                name: "PK_AppUser",
                table: "AppUser");

            migrationBuilder.DropPrimaryKey(
                name: "PK_AppRole",
                table: "AppRole");

            migrationBuilder.RenameTable(
                name: "AppUserRole",
                newName: "app_user_role");

            migrationBuilder.RenameTable(
                name: "AppUser",
                newName: "app_user");

            migrationBuilder.RenameTable(
                name: "AppRole",
                newName: "app_role");

            migrationBuilder.RenameColumn(
                name: "Remarks",
                table: "app_user_role",
                newName: "remarks");

            migrationBuilder.RenameColumn(
                name: "Id",
                table: "app_user_role",
                newName: "id");

            migrationBuilder.RenameColumn(
                name: "UpdatedBy",
                table: "app_user_role",
                newName: "updated_by");

            migrationBuilder.RenameColumn(
                name: "UpdatedAt",
                table: "app_user_role",
                newName: "updated_at");

            migrationBuilder.RenameColumn(
                name: "IsDeleted",
                table: "app_user_role",
                newName: "is_deleted");

            migrationBuilder.RenameColumn(
                name: "IsActived",
                table: "app_user_role",
                newName: "is_actived");

            migrationBuilder.RenameColumn(
                name: "DisplayOrder",
                table: "app_user_role",
                newName: "display_order");

            migrationBuilder.RenameColumn(
                name: "CreatedBy",
                table: "app_user_role",
                newName: "created_by");

            migrationBuilder.RenameColumn(
                name: "CreatedAt",
                table: "app_user_role",
                newName: "created_at");

            migrationBuilder.RenameColumn(
                name: "AppUserId",
                table: "app_user_role",
                newName: "app_user_id");

            migrationBuilder.RenameColumn(
                name: "AppRoleId",
                table: "app_user_role",
                newName: "app_role_id");

            migrationBuilder.RenameIndex(
                name: "IX_AppUserRole_AppUserId",
                table: "app_user_role",
                newName: "IX_app_user_role_app_user_id");

            migrationBuilder.RenameIndex(
                name: "IX_AppUserRole_AppRoleId",
                table: "app_user_role",
                newName: "IX_app_user_role_app_role_id");

            migrationBuilder.RenameColumn(
                name: "Username",
                table: "app_user",
                newName: "username");

            migrationBuilder.RenameColumn(
                name: "Remarks",
                table: "app_user",
                newName: "remarks");

            migrationBuilder.RenameColumn(
                name: "Password",
                table: "app_user",
                newName: "password");

            migrationBuilder.RenameColumn(
                name: "Id",
                table: "app_user",
                newName: "id");

            migrationBuilder.RenameColumn(
                name: "UpdatedBy",
                table: "app_user",
                newName: "updated_by");

            migrationBuilder.RenameColumn(
                name: "UpdatedAt",
                table: "app_user",
                newName: "updated_at");

            migrationBuilder.RenameColumn(
                name: "IsDeleted",
                table: "app_user",
                newName: "is_deleted");

            migrationBuilder.RenameColumn(
                name: "IsActived",
                table: "app_user",
                newName: "is_actived");

            migrationBuilder.RenameColumn(
                name: "DisplayOrder",
                table: "app_user",
                newName: "display_order");

            migrationBuilder.RenameColumn(
                name: "CreatedBy",
                table: "app_user",
                newName: "created_by");

            migrationBuilder.RenameColumn(
                name: "CreatedAt",
                table: "app_user",
                newName: "created_at");

            migrationBuilder.RenameColumn(
                name: "Remarks",
                table: "app_role",
                newName: "remarks");

            migrationBuilder.RenameColumn(
                name: "Id",
                table: "app_role",
                newName: "id");

            migrationBuilder.RenameColumn(
                name: "UpdatedBy",
                table: "app_role",
                newName: "updated_by");

            migrationBuilder.RenameColumn(
                name: "UpdatedAt",
                table: "app_role",
                newName: "updated_at");

            migrationBuilder.RenameColumn(
                name: "RoleName",
                table: "app_role",
                newName: "role_name");

            migrationBuilder.RenameColumn(
                name: "IsDeleted",
                table: "app_role",
                newName: "is_deleted");

            migrationBuilder.RenameColumn(
                name: "IsActived",
                table: "app_role",
                newName: "is_actived");

            migrationBuilder.RenameColumn(
                name: "DisplayOrder",
                table: "app_role",
                newName: "display_order");

            migrationBuilder.RenameColumn(
                name: "CreatedBy",
                table: "app_role",
                newName: "created_by");

            migrationBuilder.RenameColumn(
                name: "CreatedAt",
                table: "app_role",
                newName: "created_at");

            migrationBuilder.AlterColumn<string>(
                name: "remarks",
                table: "app_user_role",
                type: "character varying(800)",
                maxLength: 800,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "text",
                oldNullable: true)
                .Annotation("Relational:ColumnOrder", 999);

            migrationBuilder.AlterColumn<Guid>(
                name: "id",
                table: "app_user_role",
                type: "uuid",
                nullable: false,
                oldClrType: typeof(Guid),
                oldType: "uuid")
                .Annotation("Relational:ColumnOrder", 0);

            migrationBuilder.AlterColumn<Guid>(
                name: "updated_by",
                table: "app_user_role",
                type: "uuid",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uuid",
                oldNullable: true)
                .Annotation("Relational:ColumnOrder", 995);

            migrationBuilder.AlterColumn<DateTime>(
                name: "updated_at",
                table: "app_user_role",
                type: "timestamp with time zone",
                nullable: false,
                oldClrType: typeof(DateTime),
                oldType: "timestamp with time zone")
                .Annotation("Relational:ColumnOrder", 993);

            migrationBuilder.AlterColumn<bool>(
                name: "is_deleted",
                table: "app_user_role",
                type: "boolean",
                nullable: false,
                oldClrType: typeof(bool),
                oldType: "boolean")
                .Annotation("Relational:ColumnOrder", 997);

            migrationBuilder.AlterColumn<bool>(
                name: "is_actived",
                table: "app_user_role",
                type: "boolean",
                nullable: false,
                oldClrType: typeof(bool),
                oldType: "boolean")
                .Annotation("Relational:ColumnOrder", 996);

            migrationBuilder.AlterColumn<int>(
                name: "display_order",
                table: "app_user_role",
                type: "integer",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "integer")
                .Annotation("Relational:ColumnOrder", 998);

            migrationBuilder.AlterColumn<Guid>(
                name: "created_by",
                table: "app_user_role",
                type: "uuid",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uuid",
                oldNullable: true)
                .Annotation("Relational:ColumnOrder", 994);

            migrationBuilder.AlterColumn<DateTime>(
                name: "created_at",
                table: "app_user_role",
                type: "timestamp with time zone",
                nullable: false,
                oldClrType: typeof(DateTime),
                oldType: "timestamp with time zone")
                .Annotation("Relational:ColumnOrder", 992);

            migrationBuilder.AlterColumn<Guid>(
                name: "app_user_id",
                table: "app_user_role",
                type: "uuid",
                maxLength: 200,
                nullable: false,
                oldClrType: typeof(Guid),
                oldType: "uuid")
                .Annotation("Relational:ColumnOrder", 1);

            migrationBuilder.AlterColumn<Guid>(
                name: "app_role_id",
                table: "app_user_role",
                type: "uuid",
                maxLength: 2000,
                nullable: false,
                oldClrType: typeof(Guid),
                oldType: "uuid")
                .Annotation("Relational:ColumnOrder", 2);

            migrationBuilder.AlterColumn<string>(
                name: "username",
                table: "app_user",
                type: "character varying(200)",
                maxLength: 200,
                nullable: false,
                oldClrType: typeof(string),
                oldType: "text")
                .Annotation("Relational:ColumnOrder", 1);

            migrationBuilder.AlterColumn<string>(
                name: "remarks",
                table: "app_user",
                type: "character varying(800)",
                maxLength: 800,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "text",
                oldNullable: true)
                .Annotation("Relational:ColumnOrder", 999);

            migrationBuilder.AlterColumn<string>(
                name: "password",
                table: "app_user",
                type: "character varying(200)",
                maxLength: 200,
                nullable: false,
                oldClrType: typeof(string),
                oldType: "text")
                .Annotation("Relational:ColumnOrder", 2);

            migrationBuilder.AlterColumn<Guid>(
                name: "id",
                table: "app_user",
                type: "uuid",
                nullable: false,
                oldClrType: typeof(Guid),
                oldType: "uuid")
                .Annotation("Relational:ColumnOrder", 0);

            migrationBuilder.AlterColumn<Guid>(
                name: "updated_by",
                table: "app_user",
                type: "uuid",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uuid",
                oldNullable: true)
                .Annotation("Relational:ColumnOrder", 995);

            migrationBuilder.AlterColumn<DateTime>(
                name: "updated_at",
                table: "app_user",
                type: "timestamp with time zone",
                nullable: false,
                oldClrType: typeof(DateTime),
                oldType: "timestamp with time zone")
                .Annotation("Relational:ColumnOrder", 993);

            migrationBuilder.AlterColumn<bool>(
                name: "is_deleted",
                table: "app_user",
                type: "boolean",
                nullable: false,
                oldClrType: typeof(bool),
                oldType: "boolean")
                .Annotation("Relational:ColumnOrder", 997);

            migrationBuilder.AlterColumn<bool>(
                name: "is_actived",
                table: "app_user",
                type: "boolean",
                nullable: false,
                oldClrType: typeof(bool),
                oldType: "boolean")
                .Annotation("Relational:ColumnOrder", 996);

            migrationBuilder.AlterColumn<int>(
                name: "display_order",
                table: "app_user",
                type: "integer",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "integer")
                .Annotation("Relational:ColumnOrder", 998);

            migrationBuilder.AlterColumn<Guid>(
                name: "created_by",
                table: "app_user",
                type: "uuid",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uuid",
                oldNullable: true)
                .Annotation("Relational:ColumnOrder", 994);

            migrationBuilder.AlterColumn<DateTime>(
                name: "created_at",
                table: "app_user",
                type: "timestamp with time zone",
                nullable: false,
                oldClrType: typeof(DateTime),
                oldType: "timestamp with time zone")
                .Annotation("Relational:ColumnOrder", 992);

            migrationBuilder.AlterColumn<string>(
                name: "remarks",
                table: "app_role",
                type: "character varying(800)",
                maxLength: 800,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "text",
                oldNullable: true)
                .Annotation("Relational:ColumnOrder", 999);

            migrationBuilder.AlterColumn<Guid>(
                name: "id",
                table: "app_role",
                type: "uuid",
                nullable: false,
                oldClrType: typeof(Guid),
                oldType: "uuid")
                .Annotation("Relational:ColumnOrder", 0);

            migrationBuilder.AlterColumn<Guid>(
                name: "updated_by",
                table: "app_role",
                type: "uuid",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uuid",
                oldNullable: true)
                .Annotation("Relational:ColumnOrder", 995);

            migrationBuilder.AlterColumn<DateTime>(
                name: "updated_at",
                table: "app_role",
                type: "timestamp with time zone",
                nullable: false,
                oldClrType: typeof(DateTime),
                oldType: "timestamp with time zone")
                .Annotation("Relational:ColumnOrder", 993);

            migrationBuilder.AlterColumn<string>(
                name: "role_name",
                table: "app_role",
                type: "character varying(200)",
                maxLength: 200,
                nullable: false,
                oldClrType: typeof(string),
                oldType: "text")
                .Annotation("Relational:ColumnOrder", 1);

            migrationBuilder.AlterColumn<bool>(
                name: "is_deleted",
                table: "app_role",
                type: "boolean",
                nullable: false,
                oldClrType: typeof(bool),
                oldType: "boolean")
                .Annotation("Relational:ColumnOrder", 997);

            migrationBuilder.AlterColumn<bool>(
                name: "is_actived",
                table: "app_role",
                type: "boolean",
                nullable: false,
                oldClrType: typeof(bool),
                oldType: "boolean")
                .Annotation("Relational:ColumnOrder", 996);

            migrationBuilder.AlterColumn<int>(
                name: "display_order",
                table: "app_role",
                type: "integer",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "integer")
                .Annotation("Relational:ColumnOrder", 998);

            migrationBuilder.AlterColumn<Guid>(
                name: "created_by",
                table: "app_role",
                type: "uuid",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uuid",
                oldNullable: true)
                .Annotation("Relational:ColumnOrder", 994);

            migrationBuilder.AlterColumn<DateTime>(
                name: "created_at",
                table: "app_role",
                type: "timestamp with time zone",
                nullable: false,
                oldClrType: typeof(DateTime),
                oldType: "timestamp with time zone")
                .Annotation("Relational:ColumnOrder", 992);

            migrationBuilder.AddPrimaryKey(
                name: "PK_app_user_role",
                table: "app_user_role",
                column: "id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_app_user",
                table: "app_user",
                column: "id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_app_role",
                table: "app_role",
                column: "id");

            migrationBuilder.AddForeignKey(
                name: "FK_app_user_role_app_role_app_role_id",
                table: "app_user_role",
                column: "app_role_id",
                principalTable: "app_role",
                principalColumn: "id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_app_user_role_app_user_app_user_id",
                table: "app_user_role",
                column: "app_user_id",
                principalTable: "app_user",
                principalColumn: "id",
                onDelete: ReferentialAction.Cascade);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_app_user_role_app_role_app_role_id",
                table: "app_user_role");

            migrationBuilder.DropForeignKey(
                name: "FK_app_user_role_app_user_app_user_id",
                table: "app_user_role");

            migrationBuilder.DropPrimaryKey(
                name: "PK_app_user_role",
                table: "app_user_role");

            migrationBuilder.DropPrimaryKey(
                name: "PK_app_user",
                table: "app_user");

            migrationBuilder.DropPrimaryKey(
                name: "PK_app_role",
                table: "app_role");

            migrationBuilder.RenameTable(
                name: "app_user_role",
                newName: "AppUserRole");

            migrationBuilder.RenameTable(
                name: "app_user",
                newName: "AppUser");

            migrationBuilder.RenameTable(
                name: "app_role",
                newName: "AppRole");

            migrationBuilder.RenameColumn(
                name: "remarks",
                table: "AppUserRole",
                newName: "Remarks");

            migrationBuilder.RenameColumn(
                name: "id",
                table: "AppUserRole",
                newName: "Id");

            migrationBuilder.RenameColumn(
                name: "updated_by",
                table: "AppUserRole",
                newName: "UpdatedBy");

            migrationBuilder.RenameColumn(
                name: "updated_at",
                table: "AppUserRole",
                newName: "UpdatedAt");

            migrationBuilder.RenameColumn(
                name: "is_deleted",
                table: "AppUserRole",
                newName: "IsDeleted");

            migrationBuilder.RenameColumn(
                name: "is_actived",
                table: "AppUserRole",
                newName: "IsActived");

            migrationBuilder.RenameColumn(
                name: "display_order",
                table: "AppUserRole",
                newName: "DisplayOrder");

            migrationBuilder.RenameColumn(
                name: "created_by",
                table: "AppUserRole",
                newName: "CreatedBy");

            migrationBuilder.RenameColumn(
                name: "created_at",
                table: "AppUserRole",
                newName: "CreatedAt");

            migrationBuilder.RenameColumn(
                name: "app_user_id",
                table: "AppUserRole",
                newName: "AppUserId");

            migrationBuilder.RenameColumn(
                name: "app_role_id",
                table: "AppUserRole",
                newName: "AppRoleId");

            migrationBuilder.RenameIndex(
                name: "IX_app_user_role_app_user_id",
                table: "AppUserRole",
                newName: "IX_AppUserRole_AppUserId");

            migrationBuilder.RenameIndex(
                name: "IX_app_user_role_app_role_id",
                table: "AppUserRole",
                newName: "IX_AppUserRole_AppRoleId");

            migrationBuilder.RenameColumn(
                name: "username",
                table: "AppUser",
                newName: "Username");

            migrationBuilder.RenameColumn(
                name: "remarks",
                table: "AppUser",
                newName: "Remarks");

            migrationBuilder.RenameColumn(
                name: "password",
                table: "AppUser",
                newName: "Password");

            migrationBuilder.RenameColumn(
                name: "id",
                table: "AppUser",
                newName: "Id");

            migrationBuilder.RenameColumn(
                name: "updated_by",
                table: "AppUser",
                newName: "UpdatedBy");

            migrationBuilder.RenameColumn(
                name: "updated_at",
                table: "AppUser",
                newName: "UpdatedAt");

            migrationBuilder.RenameColumn(
                name: "is_deleted",
                table: "AppUser",
                newName: "IsDeleted");

            migrationBuilder.RenameColumn(
                name: "is_actived",
                table: "AppUser",
                newName: "IsActived");

            migrationBuilder.RenameColumn(
                name: "display_order",
                table: "AppUser",
                newName: "DisplayOrder");

            migrationBuilder.RenameColumn(
                name: "created_by",
                table: "AppUser",
                newName: "CreatedBy");

            migrationBuilder.RenameColumn(
                name: "created_at",
                table: "AppUser",
                newName: "CreatedAt");

            migrationBuilder.RenameColumn(
                name: "remarks",
                table: "AppRole",
                newName: "Remarks");

            migrationBuilder.RenameColumn(
                name: "id",
                table: "AppRole",
                newName: "Id");

            migrationBuilder.RenameColumn(
                name: "updated_by",
                table: "AppRole",
                newName: "UpdatedBy");

            migrationBuilder.RenameColumn(
                name: "updated_at",
                table: "AppRole",
                newName: "UpdatedAt");

            migrationBuilder.RenameColumn(
                name: "role_name",
                table: "AppRole",
                newName: "RoleName");

            migrationBuilder.RenameColumn(
                name: "is_deleted",
                table: "AppRole",
                newName: "IsDeleted");

            migrationBuilder.RenameColumn(
                name: "is_actived",
                table: "AppRole",
                newName: "IsActived");

            migrationBuilder.RenameColumn(
                name: "display_order",
                table: "AppRole",
                newName: "DisplayOrder");

            migrationBuilder.RenameColumn(
                name: "created_by",
                table: "AppRole",
                newName: "CreatedBy");

            migrationBuilder.RenameColumn(
                name: "created_at",
                table: "AppRole",
                newName: "CreatedAt");

            migrationBuilder.AlterColumn<string>(
                name: "Remarks",
                table: "AppUserRole",
                type: "text",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "character varying(800)",
                oldMaxLength: 800,
                oldNullable: true)
                .OldAnnotation("Relational:ColumnOrder", 999);

            migrationBuilder.AlterColumn<Guid>(
                name: "Id",
                table: "AppUserRole",
                type: "uuid",
                nullable: false,
                oldClrType: typeof(Guid),
                oldType: "uuid")
                .OldAnnotation("Relational:ColumnOrder", 0);

            migrationBuilder.AlterColumn<Guid>(
                name: "UpdatedBy",
                table: "AppUserRole",
                type: "uuid",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uuid",
                oldNullable: true)
                .OldAnnotation("Relational:ColumnOrder", 995);

            migrationBuilder.AlterColumn<DateTime>(
                name: "UpdatedAt",
                table: "AppUserRole",
                type: "timestamp with time zone",
                nullable: false,
                oldClrType: typeof(DateTime),
                oldType: "timestamp with time zone")
                .OldAnnotation("Relational:ColumnOrder", 993);

            migrationBuilder.AlterColumn<bool>(
                name: "IsDeleted",
                table: "AppUserRole",
                type: "boolean",
                nullable: false,
                oldClrType: typeof(bool),
                oldType: "boolean")
                .OldAnnotation("Relational:ColumnOrder", 997);

            migrationBuilder.AlterColumn<bool>(
                name: "IsActived",
                table: "AppUserRole",
                type: "boolean",
                nullable: false,
                oldClrType: typeof(bool),
                oldType: "boolean")
                .OldAnnotation("Relational:ColumnOrder", 996);

            migrationBuilder.AlterColumn<int>(
                name: "DisplayOrder",
                table: "AppUserRole",
                type: "integer",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "integer")
                .OldAnnotation("Relational:ColumnOrder", 998);

            migrationBuilder.AlterColumn<Guid>(
                name: "CreatedBy",
                table: "AppUserRole",
                type: "uuid",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uuid",
                oldNullable: true)
                .OldAnnotation("Relational:ColumnOrder", 994);

            migrationBuilder.AlterColumn<DateTime>(
                name: "CreatedAt",
                table: "AppUserRole",
                type: "timestamp with time zone",
                nullable: false,
                oldClrType: typeof(DateTime),
                oldType: "timestamp with time zone")
                .OldAnnotation("Relational:ColumnOrder", 992);

            migrationBuilder.AlterColumn<Guid>(
                name: "AppUserId",
                table: "AppUserRole",
                type: "uuid",
                nullable: false,
                oldClrType: typeof(Guid),
                oldType: "uuid",
                oldMaxLength: 200)
                .OldAnnotation("Relational:ColumnOrder", 1);

            migrationBuilder.AlterColumn<Guid>(
                name: "AppRoleId",
                table: "AppUserRole",
                type: "uuid",
                nullable: false,
                oldClrType: typeof(Guid),
                oldType: "uuid",
                oldMaxLength: 2000)
                .OldAnnotation("Relational:ColumnOrder", 2);

            migrationBuilder.AlterColumn<string>(
                name: "Username",
                table: "AppUser",
                type: "text",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "character varying(200)",
                oldMaxLength: 200)
                .OldAnnotation("Relational:ColumnOrder", 1);

            migrationBuilder.AlterColumn<string>(
                name: "Remarks",
                table: "AppUser",
                type: "text",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "character varying(800)",
                oldMaxLength: 800,
                oldNullable: true)
                .OldAnnotation("Relational:ColumnOrder", 999);

            migrationBuilder.AlterColumn<string>(
                name: "Password",
                table: "AppUser",
                type: "text",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "character varying(200)",
                oldMaxLength: 200)
                .OldAnnotation("Relational:ColumnOrder", 2);

            migrationBuilder.AlterColumn<Guid>(
                name: "Id",
                table: "AppUser",
                type: "uuid",
                nullable: false,
                oldClrType: typeof(Guid),
                oldType: "uuid")
                .OldAnnotation("Relational:ColumnOrder", 0);

            migrationBuilder.AlterColumn<Guid>(
                name: "UpdatedBy",
                table: "AppUser",
                type: "uuid",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uuid",
                oldNullable: true)
                .OldAnnotation("Relational:ColumnOrder", 995);

            migrationBuilder.AlterColumn<DateTime>(
                name: "UpdatedAt",
                table: "AppUser",
                type: "timestamp with time zone",
                nullable: false,
                oldClrType: typeof(DateTime),
                oldType: "timestamp with time zone")
                .OldAnnotation("Relational:ColumnOrder", 993);

            migrationBuilder.AlterColumn<bool>(
                name: "IsDeleted",
                table: "AppUser",
                type: "boolean",
                nullable: false,
                oldClrType: typeof(bool),
                oldType: "boolean")
                .OldAnnotation("Relational:ColumnOrder", 997);

            migrationBuilder.AlterColumn<bool>(
                name: "IsActived",
                table: "AppUser",
                type: "boolean",
                nullable: false,
                oldClrType: typeof(bool),
                oldType: "boolean")
                .OldAnnotation("Relational:ColumnOrder", 996);

            migrationBuilder.AlterColumn<int>(
                name: "DisplayOrder",
                table: "AppUser",
                type: "integer",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "integer")
                .OldAnnotation("Relational:ColumnOrder", 998);

            migrationBuilder.AlterColumn<Guid>(
                name: "CreatedBy",
                table: "AppUser",
                type: "uuid",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uuid",
                oldNullable: true)
                .OldAnnotation("Relational:ColumnOrder", 994);

            migrationBuilder.AlterColumn<DateTime>(
                name: "CreatedAt",
                table: "AppUser",
                type: "timestamp with time zone",
                nullable: false,
                oldClrType: typeof(DateTime),
                oldType: "timestamp with time zone")
                .OldAnnotation("Relational:ColumnOrder", 992);

            migrationBuilder.AlterColumn<string>(
                name: "Remarks",
                table: "AppRole",
                type: "text",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "character varying(800)",
                oldMaxLength: 800,
                oldNullable: true)
                .OldAnnotation("Relational:ColumnOrder", 999);

            migrationBuilder.AlterColumn<Guid>(
                name: "Id",
                table: "AppRole",
                type: "uuid",
                nullable: false,
                oldClrType: typeof(Guid),
                oldType: "uuid")
                .OldAnnotation("Relational:ColumnOrder", 0);

            migrationBuilder.AlterColumn<Guid>(
                name: "UpdatedBy",
                table: "AppRole",
                type: "uuid",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uuid",
                oldNullable: true)
                .OldAnnotation("Relational:ColumnOrder", 995);

            migrationBuilder.AlterColumn<DateTime>(
                name: "UpdatedAt",
                table: "AppRole",
                type: "timestamp with time zone",
                nullable: false,
                oldClrType: typeof(DateTime),
                oldType: "timestamp with time zone")
                .OldAnnotation("Relational:ColumnOrder", 993);

            migrationBuilder.AlterColumn<string>(
                name: "RoleName",
                table: "AppRole",
                type: "text",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "character varying(200)",
                oldMaxLength: 200)
                .OldAnnotation("Relational:ColumnOrder", 1);

            migrationBuilder.AlterColumn<bool>(
                name: "IsDeleted",
                table: "AppRole",
                type: "boolean",
                nullable: false,
                oldClrType: typeof(bool),
                oldType: "boolean")
                .OldAnnotation("Relational:ColumnOrder", 997);

            migrationBuilder.AlterColumn<bool>(
                name: "IsActived",
                table: "AppRole",
                type: "boolean",
                nullable: false,
                oldClrType: typeof(bool),
                oldType: "boolean")
                .OldAnnotation("Relational:ColumnOrder", 996);

            migrationBuilder.AlterColumn<int>(
                name: "DisplayOrder",
                table: "AppRole",
                type: "integer",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "integer")
                .OldAnnotation("Relational:ColumnOrder", 998);

            migrationBuilder.AlterColumn<Guid>(
                name: "CreatedBy",
                table: "AppRole",
                type: "uuid",
                nullable: true,
                oldClrType: typeof(Guid),
                oldType: "uuid",
                oldNullable: true)
                .OldAnnotation("Relational:ColumnOrder", 994);

            migrationBuilder.AlterColumn<DateTime>(
                name: "CreatedAt",
                table: "AppRole",
                type: "timestamp with time zone",
                nullable: false,
                oldClrType: typeof(DateTime),
                oldType: "timestamp with time zone")
                .OldAnnotation("Relational:ColumnOrder", 992);

            migrationBuilder.AddPrimaryKey(
                name: "PK_AppUserRole",
                table: "AppUserRole",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_AppUser",
                table: "AppUser",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_AppRole",
                table: "AppRole",
                column: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_AppUserRole_AppRole_AppRoleId",
                table: "AppUserRole",
                column: "AppRoleId",
                principalTable: "AppRole",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_AppUserRole_AppUser_AppUserId",
                table: "AppUserRole",
                column: "AppUserId",
                principalTable: "AppUser",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
    }
}
